/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lab2;

/**
 *
 * @author Mariana
 */

import java.util.*;

public class vector<E> implements Stack<E>{
    
    Vector Vec = new Vector(50, 50);
    
    public void push(E item){
        Vec.add(item);
    }

   
   public E pop(){
       E i =(E) Vec.lastElement();
       Vec.remove(i);
       return i;     
   }
  
   public E peek(){
       E x = (E) Vec.lastElement();
       return x;
   }

   public boolean empty(){
       boolean a;
      int i = Vec.size();
      if (i==0){
          a = false;
      }
      else{
          a = true;
      }
       return a;
   }
   // post: returns true if and only if the stack is empty
   
   public int size(){
       int s = Vec.size();
       return s;
   }
   
    
}
